<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0, user-scalable=no" />
<link rel="shortcut icon" href="/Images/ico/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="/css/swiper.min.css" />
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<link type="text/css" rel="stylesheet" href="/layui/css/layui.css"  media="all">
<script type="text/javascript" src="/layui/layui.js" charset="utf-8"></script>
<script src="/js/jquery.min.js" type="text/javascript"></script>
<script src="/js/swiper.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/custom.js"></script>
<script type="text/javascript" src="/js/layui-post.js"></script>
</head>
<body>
<div class="headerbox">
  <div class="ng-scope">
    <div class="loca ng-scope title-order" style="background: #f9fafd;">
      <a class="title-top" href="javascript:window.history.back();"></a>
      <a class="title-center">我的优惠券</a>
      <a class="title-right" href="/index"></a>
    </div>
  </div>
</div>
<div class="quannewsbox" style="margin-top: 50px;position: fixed;width: 100%;top: 0px;z-index: 10;">
  <ul id="integralType">
    <li class="on" data-value="0"><a>已领取</a></li>
    <li data-value="1"><a>已使用</a></li>
    <li data-value="2"><a>已过期</a></li>
  </ul>
</div>
<div class="clear"></div>
<div class="quannewsbox1"></div>
<div class="cartempty ng-scope ng-hide">
  <h3>暂无数据</h3>
</div>
<div class="clear"></div>
<div class="fbox"></div>
</body>
<script>
$.ajaxSetup({contentType: "application/json; charset=utf-8"});
var userInfo = $.parseJSON(sessionStorage.getItem("userInfo"));
window.addEventListener('scroll', function(){
  let t = $('body, html').scrollTop();   // 目前监听的是整个body的滚动条距离
  if(t>132)  $('.jfgl').addClass('box-active')
  else  $('.jfgl').removeClass('box-active')
})
layui.use(['layer','form','element','util'], function(){
  $("#jfnum").html(userInfo.integral)
  layui.util.fixbar({
    top:true,
    css: { right: 15, bottom: 105 },
    showHeight:100,
    click: function (type) {
      if (type === 'top') {
        $('.layui-fluid').animate({//主要代码
          scrollTop: 0
        }, 200);
      }
    }
  });
  showData();
})
function showData(type){
  var data = {userId:userInfo.userId};
  if(!isEmpty(type)) data['status'] = type;
  $.post("/cateringUserCoupon/select",JSON.stringify(data), function (res) {
    $(".quannewsbox1").html("")
    if(res.data.length == 0) $(".cartempty").removeClass("ng-hide")
    else $(".cartempty").addClass("ng-hide")
    for(var i in res.data){
        $(".quannewsbox1").append(
              '<div class="quannews_1">' +
              '<div class="quanbg"><img src="/images/q1.png" /></div>' +
              '<div class="quanb">' +
              '<div class="quanL">' +
              '<p class="p1">实付满69元使用</p>' +
              '<p class="p2">2018年7月20日至2018年8月20日</p>' +
              '</div>' +
              '<div class="quanR">' +
              '<p class="p3">￥10元</p>' +
              '<a href="quanNews_xq.html" class="a1">立即使用</a>' +
              '</div>' +
              '<div class="clear"></div>' +
              '</div>' +
              '<div class="quanbg"><img src="/images/q3.png" /></div>' +
              '<div class="quanstate"><img src="/images/q5.png" /></div>' +
              '</div>'
        )
      }
  })
}
$("#integralType li").each(function () {
  $(this).click(function () {
    $("#integralType li").removeClass("on");
    $(this).addClass("on");
    showData($(this).attr("data-value"))
  });
});
</script>
</html>
